package org.hughie.springframework.test.bean;

import org.hughie.springframework.beans.factory.annotation.Autowired;
import org.hughie.springframework.beans.factory.annotation.Value;
import org.hughie.springframework.stereotype.Component;

import java.util.Random;

/**
 * @author hughie.cheng
 * @since 2023/9/13
 */
@Component
public class UserService implements IUserService {

    @Value("${token}")
    private String token;

    @Autowired
    private UserDao userDao;

    public String queryUserInfo() {
        try {
            Thread.sleep(new Random(1).nextInt(100));
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        return userDao.queryUserName("10001") + "，" + token;
    }

    // ...
}


